package org.voidness.squaretilesframework.server;

import org.voidness.oje2d.Utils;

/** A general map loader */
public class ServerMapLoader {
    /** An old (obsolete) format */
    public static final int OLD_FORMAT = 0;

    /** The current map format */
    public static final int SIMPLE_FORMAT = 1;

    /** An eventual xml format wouldn't hurt */
    public static final int XML_FORMAT = 2;

    /**
     * A static method to load a map from a file of a given format.
     * 
     * @param mFilename The filename of the map to load
     * @param mFormat The format of the map
     * @param mTileSize The tile size to use
     * @return
     */
    public static ServerMap load(String mFilename, int mFormat, int mTileSize) {
        // Check which format we want and use the appropriate loader
        switch (mFormat) {
        case SIMPLE_FORMAT:
            return (new ServerSimpleLoader()).load(mFilename, mTileSize);

            /*
             * case XML_FORMAT: return XmlMapLoader.load(mFilename);
             */
        }

        Utils.dump("Invalid map format: " + mFormat, Utils.ERROR);
        System.exit(1);

        return null; // Never gets here but it bugs me ;)
    }
}